home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / C Internet Config / IC Application Source ƒ / C Source ƒ / IC Window Globals.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-04  |  2.1 KB  |  101 lines  |  [TEXT/SPM ]

  1. /*
  2.     IC Window Globals.c
  3.     
  4. */
  5.  
  6. #include <Files.h>
  7. #include <Windows.h>
  8.  
  9. #include "IC Types.h"
  10. #include "IC Misc Subs.h"
  11. #include "IC Document.h"
  12.  
  13. #include "IC Window Globals.h"
  14.  
  15. #include "IC Globals.h"
  16.  
  17. short WT_Last;
  18.  
  19. WindowInfoRec** gWindowsInfoHandle;
  20. WindowInfoRec* WindowInfo;
  21. WhatInfoRec WhatInfo[whats_max];
  22.  
  23. short GetSelectedItem(WindowType wt){
  24.     short selected_item;
  25.     
  26.     selected_item=WindowInfo[wt].selected_item;
  27.     
  28.     if ((selected_item>0)&&(WindowInfo[wt].items[selected_item]!=(WhatRecordPtr)0)&&(WindowInfo[wt].items[selected_item]->typ=='TEXT'))
  29.         return selected_item;
  30.     
  31.     return -1;
  32. }
  33.  
  34. WindowType GetWindowType(WindowPtr wp){
  35.     WindowType i;
  36.     
  37.     if (wp!=(WindowPtr)0){
  38.         for (i=WT_None;i<WT_Last;i++){
  39.             if (WindowInfo[i].window==wp)
  40.                 return i;
  41.         }
  42.     }
  43.     
  44.     return WT_None;
  45. }
  46.  
  47. void ProcessAttributes(WindowType wt,short item,long attr){
  48.     
  49.     if ((attr!=ICattr_no_change)&&(attr&ICattr_locked_bit))
  50.         WindowInfo[wt].items[item]->flags &= wf_locked;
  51. }
  52.  
  53. Boolean IsLocked(WindowType wt,short item){
  54.     Boolean lck;
  55.     
  56.     lck=WindowInfo[wt].items[item]->flags & (1<<wf_locked);
  57.     
  58.     return ((lck)||(IsDocLocked()));
  59. }
  60.  
  61. void LockedAlert(WindowType wt,short item){
  62.     static WindowType last_alert_wt=WT_None;
  63.     static short last_alert_item=-1;
  64.     
  65.     if ((wt!=last_alert_wt)||(item!=last_alert_item)){
  66.         ResetAlertStage();
  67.         last_alert_wt=wt;
  68.         last_alert_item=item;
  69.     }
  70.     
  71.     InitCursor();
  72.     
  73.     StopAlert(143,(ModalFilterUPP)0);
  74. }
  75.  
  76. /*
  77.     InitICWindowGlobals
  78.     
  79.     Just a few additions here that were not in the pascal source.  The first item
  80.     is a call to InitUniversals(), which sets up global UniversalProcPtrs that can be used
  81.     repeatedly without having to recreate them over and over.
  82.     
  83.     The second item the dynamic creation of the WindowsInfo[] array.  This will allow a
  84.     non-programmer type to add windows to the application without having to modify and
  85.     recompile.
  86. */
  87. void InitICWindowGlobals(void){
  88.     // Initialize the callbacks
  89.     InitUniversals();
  90.     
  91.     UseResFile(app_resfile);
  92.     WT_Last=Count1Resources('WHAT')+2; // count the WHAT resources in the app
  93.     
  94.     gWindowsInfoHandle=(WindowInfoRec**)NewHandle(sizeof(WindowInfoRec)*WT_Last);
  95.     HLockHi((Handle)gWindowsInfoHandle);
  96.     WindowInfo=*gWindowsInfoHandle;
  97. }
  98.  
  99.  
  100.  
  101.